unit UfrmProductEdit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UfrmStandarEdit, DB, ADODB, RzTabs, ExtCtrls, RzPanel, RzDlgBtn,
  UfrmBaseEdit, StdCtrls, Mask, DBCtrls, HzSpell, RzCommon;

type
  TfrmProductEdit = class(TfrmStandarEdit)
    qryProduct: TADOQuery;
    TabSheet2: TRzTabSheet;
    DataSource1: TDataSource;
    qryProductPRODUCTID: TAutoIncField;
    qryProductPRODUCTNUMBER: TStringField;
    qryProductPRODUCTNAME: TStringField;
    qryProductPRODUCTMODLE: TStringField;
    qryProductPRODUCTUNIT: TStringField;
    qryProductSPELL: TStringField;
    qryProductBARCODE: TStringField;
    qryProductPRODUCTSORT: TStringField;
    qryProductPACTUNIT: TStringField;
    qryProductPACTAMOUNT: TBCDField;
    qryProductOTHERNAME: TStringField;
    qryProductSTOCKPRICE: TBCDField;
    qryProductSELLPRICE: TBCDField;
    qryProductSELLPRICE1: TBCDField;
    qryProductSELLPRICE3: TBCDField;
    qryProductSELLPRICE2: TBCDField;
    qryProductMAXSTORAGE: TBCDField;
    qryProductMINSTORAGE: TBCDField;
    qryProductERASESIGN: TBooleanField;
    qryProductPRODUCTAREA: TStringField;
    qryProductQUALITYTIME: TIntegerField;
    qryProductRECOMMEND: TBooleanField;
    qryProductNOPRICEGOODS: TBooleanField;
    qryProductNOQUANTITYGOODS: TBooleanField;
    qryProductMINDISCOUNT: TBCDField;
    qryProductSTORGEIDENT: TStringField;
    qryProductINTEGRAL: TBCDField;
    qryProductCLIENTID: TIntegerField;
    qryProductPICTURE: TBlobField;
    qryProductCREATEDATE: TDateTimeField;
    qryProductUSERNAME: TStringField;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    Label5: TLabel;
    DBEdit5: TDBEdit;
    Label6: TLabel;
    DBEdit6: TDBEdit;
    Label7: TLabel;
    DBEdit7: TDBEdit;
    Label8: TLabel;
    DBEdit8: TDBEdit;
    Label9: TLabel;
    DBEdit9: TDBEdit;
    Label10: TLabel;
    DBEdit10: TDBEdit;
    Label11: TLabel;
    DBEdit11: TDBEdit;
    Label12: TLabel;
    DBEdit12: TDBEdit;
    Label13: TLabel;
    DBEdit13: TDBEdit;
    DBCheckBox1: TDBCheckBox;
    DBCheckBox2: TDBCheckBox;
    Label14: TLabel;
    DBEdit14: TDBEdit;
    DBCheckBox3: TDBCheckBox;
    DBCheckBox4: TDBCheckBox;
    Label15: TLabel;
    DBEdit15: TDBEdit;
    Label16: TLabel;
    DBEdit16: TDBEdit;
    Label17: TLabel;
    DBEdit17: TDBEdit;
    Label18: TLabel;
    DBEdit18: TDBEdit;
    Label19: TLabel;
    DBEdit19: TDBEdit;
    Label20: TLabel;
    DBEdit20: TDBEdit;
    procedure RzDialogButtons1ClickOk(Sender: TObject);
    procedure RzDialogButtons1ClickCancel(Sender: TObject);
    procedure DBEdit2Change(Sender: TObject);
  private
    { Private declarations }
  public
    function Edit(const Params:Variant):Boolean;override;
    function Enter:Boolean;override;
  end;

var
  frmProductEdit: TfrmProductEdit;

implementation

uses UdataMoudule;

{$R *.dfm}

{ TfrmProductEdit }

function TfrmProductEdit.Edit(const Params: Variant): Boolean;
begin
 // ShowMessage(VarToStr(Params));
  qryProduct.Open;
  qryProduct.Locate('productid',Params,[]);
  Result:=  ShowModal = mrOk;
end;

function TfrmProductEdit.Enter: Boolean;
begin
  qryProduct.Open;
  qryProduct.Insert;
  Result:=  ShowModal = mrOk;

end;

procedure TfrmProductEdit.RzDialogButtons1ClickOk(Sender: TObject);
begin
  if qryProduct.State in [dsedit,dsinsert] then
   try
       qryProduct.Post;
   finally
        ModalResult:=mrOk;
   end;
  inherited;


end;

procedure TfrmProductEdit.RzDialogButtons1ClickCancel(Sender: TObject);
begin
  inherited;
  ModalResult:=mrCancel;
end;

procedure TfrmProductEdit.DBEdit2Change(Sender: TObject);
begin
  inherited;
    DBEdit3.Text:=UpperCase(THzSpell.PyHeadOfHz(DBEdit2.Text));
    

end;

end.
